<template>
  <div>
    <div style="background-color: #f5f5f5;border-bottom: #dedede 1px solid">
      <div class="ok-page-width" style="font-size: 14px; color: #3a3a3a">
        <div class="ok-box-flex">
          <div class="ok-box-center-left" style="height: 45px;">
            <span style="margin-left: 15px;"></span> 欢迎来到特色乡村 {{ time }}
          </div>
        </div>
      </div>
    </div>
    <div class="ok-white" style="border-bottom: #0092FF 2px solid">
      <div class="ok-page-width">
        <div class="ok-box-flex" style="padding-top: 2px; padding-bottom: 2px;">
          <div class="ok-box-center-left">
<!--            <el-image style="height:55px;cursor:pointer"></el-image>-->
          </div>
          <div id="parkmenu" class="ok-width-max ok-box-center park-menu-main" style="height: 90px;">
            <div class="menu-item active" id="home" @click="routerPush('/')">乡村主页</div>
            <div class="menu-item" id="introduce" @click="routerPush('/views/introduce/index')">乡村介绍</div>
            <div class="menu-item" id="product" @click="routerPush('/views/product/index')">特色产品</div>
            <div class="menu-item" id="news" @click="routerPush('/views/news/index')">新闻中心</div>
            <div class="menu-item" id="attractions" @click="routerPush('/views/attractions/index')">周边景点</div>
            <div class="menu-item" id="contact" @click="routerPush('/views/contact/index')">联系我们</div>
          </div>
          <div class="ok-box-center-left" style="margin-right: 100px">
            <div v-if="ok.tool.getStatus()"  @click="goLogin">
              <el-image :src="require('@/static/images/user1.png')" style="height:30px;"></el-image>
            </div>
            <div v-else>
              <el-button type="primary" @click="goLogin">登录</el-button>
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>
<script>
import moment from "moment"
import $ from 'jquery'
import Cookies from "js-cookie"
import ok from "@/assets/ok";
export default {
  computed: {
    ok() {
      return ok
    }
  },
  components:{},
  data(){
    return{
      time:"",
      user:false,
    }
  },
  mounted() {
    this.init();
    this.styleShow();
  },
  methods:{
    init(){
      this.time = moment().format('YYYY-MM-DD')
    },
    routerPush(url){
      if (this.$route.path !== url){
        this.$router.push(url);
      }
    },
    styleShow(){
      let path = this.$route.path;
      console.log(path)
      $("#parkmenu").children("div").each(function(){
        if (path.indexOf($(this).attr("id"))>0){
          $(this).addClass("active");
          $("#home").removeClass("active");
        }
      });
    },

    goLogin(){
      this.$router.push("/views/manage/login/loginHome")
    }
    // getUser(){
    //   let user = Cookies.get("Token");
    //   if (user){
    //     this.user = true;
    //   }else{
    //     this.user = false;
    //   }
    // }
  }
}
</script>
